
<template>
  <el-dropdown class="LogOut">
    <span class="el-dropdown-link">
      {{ info.ZKMC }} / {{ info.YHXM }}<i class="el-icon-arrow-down el-icon--right"></i>
    </span>
    <el-dropdown-menu slot="dropdown">
      <el-dropdown-item @click.native="logOut()">退出登录</el-dropdown-item>
    </el-dropdown-menu>
  </el-dropdown>
</template>

<script>
import {getStorage,deleteStorage} from "UTILS/util";


import { CONSENT_LOGIN_OUT } from "_SERVICES/api";

export default {
  name: "LogOut",
  props: {
    fixed: {
      type: Boolean,
      required: false,
    },
  },
  data() {
    return {
      info:""
    };
  },
  created() {
    this.info = getStorage("cst_userInfo")?JSON.parse(getStorage("cst_userInfo")):{};
  },
  computed: {},
  methods: {
    goPage(path) {
      console.log(this.path);
      this.$router.push({
        path: path,
      });
    },
    logOut(){

      CONSENT_LOGIN_OUT({

      }).then((res)=>{
        deleteStorage("cst_userInfo");
        this.$router.push({
          path: '/login',
        });
      })
     
    }
  },
};
</script>
<style scoped lang="less" >
.LogOut {
  .el-dropdown-link {
    cursor: pointer;
    color: #409eff;
  }
  .el-icon-arrow-down {
    font-size: 12px;
  }
}
</style>
